﻿// TODO: Header description & license information.

#ifndef PENNYWORTH_SENSORS
#define PENNYWORTH_SENSORS

#include <iostream>
#include <map>
#include <string>
#include <vector>

typedef char SensorState;

#define STATE_RUNNING 0x00
#define STATE_PAUSED  0x01
#define STATE_ERROR   0x02

namespace Pennyworth
{
	namespace Sensors
	{
		class SensorListener
		{

		};

		class Reading
		{

		};

		class Sensor
		{
			protected:
				std::wstring * sensor_name;
				std::wstring * sensor_description;
				SensorState sensor_state;
				int sensor_identifier;
				std::map<std::wstring, std::wstring> * sensor_options;
				std::vector<SensorListener> * sensor_listeners;
			public:
				Sensor();
				Sensor(std::wstring * name, std::wstring * description, int identifier, std::map<std::wstring, std::wstring> * options);

				virtual ~Sensor();
		
				std::wstring * name();

				std::wstring * description();

				int identifier();

				SensorState state();
				void setState(SensorState state);

				Reading * mostRecentValue();
		
				std::map<std::wstring, std::wstring> * options();
				void setOptions(std::map<std::wstring, std::wstring> * options);
		
				void addListener(SensorListener * listener);
				void removeListener(SensorListener * listener);

				std::vector<SensorListener> * listeners();
		};
		
		class DaylightSensor : public Sensor
		{
			private:
				double _latitude;
				double _longitude;
			public:
				DaylightSensor();
				DaylightSensor(std::wstring * name, std::wstring * description, int identifier, std::map<std::wstring, std::wstring> * options);

				double latitude();
				void setLatitude(double latitude);

				double longitude();
				void setLongitude(double longitude);
				
				double sunrise();
				double sunset();
		};
	}
}

#endif